package home

import (
	"fmt"
	"lib/mall/v1/controller"
	"lib/mall/v1/helpers"
	"lib/mall/v1/lib"
)

var instance *Home

func init() {
	instance = &Home{}
}

func NewHomeController() *Home {
	return instance
}

type Home struct {
	controller.Controller
}

type Person struct {
	Username string `form:"username" validate:"required"`
	Password string `form:"password"`
}

func (this *Home) Index(ctx *lib.Context) {
	println("================================")
	p1 := helpers.PasswordEncrypt("123456")
	p2 := helpers.PasswordEncrypt("123456")
	fmt.Println(p1, p2)
	var person Person
	ctx.MustValidate(&person)
	ctx.Success(person)
}
